﻿using ALMDDD.Domain.Interfaces;
using ALMDDD.Infrastructure.Context;
using System;
using System.Collections.Generic;
using System.Text;

namespace ALMDDD.Infrastructure.UnitWork
{
    /// <summary>
    /// 工作单元
    /// </summary>
    public class UnitOfWork : IunitOfWork
    {
        private readonly ALMContext _context;
        /// <summary>
        /// 构造上下文对象
        /// </summary>
        /// <param name="context"></param>
        public UnitOfWork(ALMContext context)
        {
            _context = context;
        }
        public bool Commit()
        {
            return _context.SaveChanges() > 0;
        }

        public void Dispose()
        {
            _context.Dispose();
        }
    }
}
